package com.eleadmin.common.system.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eleadmin.common.core.web.PageParam;
import com.eleadmin.common.core.web.PageResult;
import com.eleadmin.common.system.entity.Anno;
import com.eleadmin.common.system.mapper.AnnoMapper;
import com.eleadmin.common.system.param.AnnoParam;
import com.eleadmin.common.system.service.AnnoService;

/**
 * 留言表Service实现
 *
 * @author EleAdmin
 * @since 2025-04-28 22:40:00
 */
@Service
public class AnnoServiceImpl extends ServiceImpl<AnnoMapper, Anno> implements AnnoService {

    @Override
    public PageResult<Anno> pageRel(AnnoParam param) {
        PageParam<Anno, AnnoParam> page = new PageParam<>(param);
        page.setDefaultOrder("create_time desc");
        List<Anno> list = baseMapper.selectPageRel(page, param);
        return new PageResult<>(list, page.getTotal());
    }

    @Override
    public List<Anno> listRel(AnnoParam param) {
        // 使用QueryWrapper进行排序查询
        return baseMapper.selectList(
            new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<Anno>()
                .orderByDesc("create_time")
        );
    }

}
